<template>
  <div class="imgbox">
    <img :src="dogImgUrl" alt="" />
    <h2 @click="add">{{ dogName }}</h2>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: ["dogImgUrl", "dogName"],
  methods: {
    add() {
      this.$emit("childchange", this.dogName);
    },
  },
};
</script>

<style lang="less" scoped>
.imgbox {
  width: 300px;
  // height: 200px;
  border: 1px solid #888;
  float: left;
  margin: 0 10px 10px 0;
  img {
    width: 100%;
  }
  h2 {
    text-align: center;
  }
}
</style>